﻿using System;
using System.Collections.Generic;
using RockCorn.Internals;
using RockCorn.Objects.Moving;

namespace RockCorn.Objects
{
    class GiftBlock : GameObject
    {
        public new const string CollisionGroupString = "gift block";
        private bool collided = false;
        
        public GiftBlock(MatrixCoords topLeft)
            : base(topLeft, new char[,] { { (char)164 } }) //    +  --> ¤
        {

        }

        public override int GetPoints()
        {
            return 25;
        }

        public override void Update()
        {
            
        }

        public override bool CanCollideWith(string otherCollisionGroupString)
        {
            return otherCollisionGroupString == "ball";
        }

        public override void RespondToCollision(CollisionData collisionData)
        {
            this.collided = true;
        }

        public override IEnumerable<GameObject> ProduceObjects()
        {
            if (collided)
            {
                List<GameObject> gift = new List<GameObject>();
                this.IsDestroyed = true; ; // self destroy
                // drop gift
                gift.Add(new Gift(this.TopLeft));
                return gift;
            }
            else return new List<GameObject>();
        }

        public override string GetCollisionGroupString()
        {
            return GiftBlock.CollisionGroupString;
        }
    }
}
